//
//  LOLThirdDetailEquipCell.m
//  LOLXXbox
//
//  Created by dllo on 16/1/29.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLThirdDetailEquipCell.h"
#import "LOLThirdCollectionCell.h"
#import "LOLEquipDetailModel.h"
#import <UIImageView+WebCache.h>
@interface LOLThirdDetailEquipCell ()<UICollectionViewDataSource,UICollectionViewDelegate>
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) LOLEquipDetailModel *model;
@end

@implementation LOLThirdDetailEquipCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self makeCollection];
    }
    return self;
}

- (void)makeCollection{
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
    flowLayout.itemSize = CGSizeMake(60 , 60);
    flowLayout.minimumInteritemSpacing = 0;
    flowLayout.minimumLineSpacing = 5;
    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    flowLayout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
    
    self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height) collectionViewLayout:flowLayout];
    self.collectionView.dataSource = self;
    self.collectionView.delegate = self;
    [self.collectionView registerClass:[LOLThirdCollectionCell class] forCellWithReuseIdentifier:@"cell"];
    [self.contentView addSubview:self.collectionView];
    self.collectionView.backgroundColor = [UIColor whiteColor];

    

}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return self.array.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    LOLThirdCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];

//    [cell.imageViews sd_setImageWithURL:[NSURL URLWithString:@"http://img.lolbox.duowan.com/zb/%ld_64x64.png",self.array[indexPath.item]]];
//    NSLog(@"-=-=-=-=%@", self.array[indexPath.item]);
 
    return cell;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    self.collectionView.frame = self.bounds;
}
- (void)setArray:(NSArray *)array{
    _array = array;
//    NSLog(@"%@", self.array);
    [self.collectionView reloadData];

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
